.PHONY: all clean

TARGET=exploit

SOURCES = $(wildcard src/*.c)
HEADERS = $(wildcard inc/*.h)
OBJECTS = $(patsubst src/%.c,obj/%.o,$(SOURCES))

CFLAGS= -I./inc -Os
LDFLAGS= -Wall -L/lib/x86_64-linux-gnu/

all: obj $(TARGET)

$(TARGET): obj/exploit.o $(OBJECTS)
	gcc $(LDFLAGS) -o $@ $^ -static

obj/%.o: src/%.c
	gcc -c $< -o $@ $(CFLAGS)

obj/exploit.o:
	gcc -c exploit.c -o obj/exploit.o $(CFLAGS)

obj:
	mkdir obj

clean:
	rm -rf obj
	rm -f $(TARGET)
